//
//  NewsImageCell.m
//  JJHW_coreData
//
//  Created by huazi on 16/4/20.
//  Copyright © 2016年 HFKJ_LZQ. All rights reserved.
//

#import "NewsImageCell.h"

@implementation NewsImageCell

- (void)awakeFromNib {
    // Initialization code
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self =[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initSubviews];
    }
    return self;
}
- (void)initSubviews {
    self.imageNewsView =[[UIImageView alloc] initWithFrame:CGRectMake(15, 10, DeviceWidth-30, 30)];
    [self.contentView addSubview:self.imageNewsView];
}
- (void)reloadDataCell:(id)model AndHeignt:(float)height{
    self.dic =model;
    float w,h;
    w = [[model objectForKey:@"width"] floatValue];
    h = [[model objectForKey:@"height"] floatValue];
    float imageWidth =[[model objectForKey:@"width"] floatValue];
    float imageHeight =[[model objectForKey:@"height"] floatValue];
    if (imageWidth>DeviceWidth -30) {
        w =DeviceWidth-30;
        h =(DeviceWidth -30)*imageHeight/imageWidth;
    }
    self.imageNewsView.frame =CGRectMake((DeviceWidth-w)/2, 10, w, h);
    [self.imageNewsView sd_setImageWithURL:[NSURL URLWithString:[model objectForKey:@"content"]] placeholderImage:kplaceholderImage224];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}



@end
